home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 25 / Mac Magazin and MacEasy Magazine CD - Issue 25.iso / Grafik & Text / Alpha / Tcl / SystemCode / browser.tcl < prev    next >
Text File  |  1996-08-15  |  1KB  |  52 lines

  1. #=============================================================================
  2. # Browser mode.
  3. #=============================================================================
  4.  
  5.  
  6.  
  7. proc dummyBrws {} {}
  8.  
  9. proc upBrowse {} {
  10.     set limit [nextLineStart [nextLineStart 0]]
  11.     if {[getPos] > $limit} {
  12.         set limit [expr [getPos] - 1]
  13.     }
  14.     select [lineStart $limit] [nextLineStart $limit]
  15. }
  16.  
  17. proc downBrowse {} {
  18.     set pos [getPos]
  19.     if {$pos < [nextLineStart 0]} {
  20.         set pos [nextLineStart 0]
  21.     }
  22.     if {[nextLineStart $pos] != [maxPos]} {
  23.         select [nextLineStart $pos] [nextLineStart [nextLineStart $pos]]
  24.     }
  25. }
  26.  
  27. proc nextMatch {{wname "*Batch Find*"}} {
  28.     set wins [winNames]
  29.     set res [lsearch $wins $wname]
  30.     if {$res < 0} {
  31.         set res [lsearch -regexp $wins {\*.*\*}]
  32.         if {$res < 0} return
  33.     }
  34.     set win [lindex $wins $res]
  35.     bringToFront $win
  36.     downBrowse
  37.     gotoMatch
  38.     dispErr $win
  39. }
  40.  
  41. bind '\r'        gotoMatch    Brws
  42. bind enter        gotoMatch    Brws
  43. ascii 0x3          gotoMatch   Brws
  44. bind down         downBrowse Brws
  45. bind up         upBrowse Brws
  46. bind 'n' <z>    downBrowse Brws
  47. bind 'p' <z>    upBrowse Brws
  48. ascii 0x20        downBrowse Brws
  49. ascii 0x8        upBrowse Brws
  50.  
  51.  
  52.